package guru.kafka.test;

import kafka.utils.VerifiableProperties;
import org.apache.kafka.clients.producer.internals.Partitioner;

import java.util.Random;
import java.util.concurrent.atomic.AtomicLong;

/**
 * Created by xufei on 16/10/13.
 */
public class RandomPartitioner implements kafka.producer.Partitioner {

    public RandomPartitioner(VerifiableProperties verifiableProperties) {}

    @Override
    public int partition(Object key, int numPartitions) {

        return new Random().nextInt(numPartitions);

    }
}
